home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -in_the_mag- / reader_requests / wild / developer / coderhelp / extensionbase.library.s < prev    next >
Text File  |  2000-02-23  |  2KB  |  85 lines

  1.  
  2.         include    WildInc.gs
  3.         include    Wild/wild.i
  4.         include PyperLibMaker.i
  5.         include    PyperMacro.i
  6.         include    Wild/modules_macros.i
  7.  
  8. EXTTYPES1    EQU    TYPEA_FULLCOMPATIBLE<<24+TYPEB_FULLCOMPATIBLE<<16+TYPEC_FULLCOMPATIBLE<<8+TYPED_FULLCOMPATIBLE
  9. EXTTYPES2    EQU    TYPEE_FULLCOMPATIBLE<<24+TYPEF_FULLCOMPATIBLE<<16+TYPEG_FULLCOMPATIBLE<<8+TYPEH_FULLCOMPATIBLE
  10.  
  11.         Lib    ExtensionBase,1,0,08.9.1998,wdm_SIZEOF
  12.         Lib    FUNCTIONS
  13.         Lib    OpenLib
  14.         Lib    CloseLib
  15.         Lib    ExpugneLib
  16.         Lib    ExtFuncLib
  17.  
  18.         Lib    SetModuleTags
  19.         Lib    GetModuleTags
  20.         Lib    SetUpModule
  21.         Lib    CloseModule
  22.         Lib    RefreshModule
  23.  
  24.         Lib    CODE
  25.  
  26.         Lib    Init
  27.         exg    a0,d0
  28.         move.l    d0,LIB_SIZE(a0)
  29.         move.l    #MODTYPES1,wm_Types(a0)
  30.         move.l    #MODTYPES2,wm_Types+4(a0)
  31.         clr.w    wm_CNT(a0)
  32.         
  33.         ; Here you can do the First init !
  34.         ; Take care !!! Preserve A0(LibBase) and D0(Don'tKnow)
  35.         
  36.         exg    a0,d0
  37.         rts
  38.  
  39.         Lib    OpenLib
  40.         add.w    #1,LIB_OPENCNT(a6)
  41.         bset    #LIBB_DELEXP,LIB_FLAGS(a6)    ; MODULES DEFAULT ARE WANTED TO FREE THEIR MEMORY WHEN CLOSED SO THE EXPUGNE FLAG IS SET ,USUALLY. CLEAR IT ONLY IF REALLY NEEDED.
  42.         
  43.         ; Here you can do any init you want, but take care: EVERY time the
  44.         ; lib is opened, this init is done. The first time-only init is
  45.         ; in the Init routine
  46.         
  47.         move.l    a6,d0
  48.         rts
  49.  
  50.         Lib    CloseLib
  51.         subq.w    #1,LIB_OPENCNT(a6)
  52.         bne.b    ExtFuncLib
  53.         btst    #LIBB_DELEXP,LIB_FLAGS(a6)
  54.         beq.b    ExtFuncLib
  55.  
  56.         Lib    ExpugneLib
  57.         movem.l    d2/a5/a6,-(sp)
  58.         tst.w    LIB_OPENCNT(a6) 
  59.         bne.b    .still_openned
  60.  
  61.         ;On this place free all resources which has been
  62.         ;allocated in init part. a6 contain library base.
  63.  
  64.         move.l    LIB_SIZE(a6),d2
  65.         move.l    a6,a5
  66.         move.l    4.w,a6
  67.         move.l    a5,a1
  68.         jsr    _LVORemove(a6)
  69.         move.l    a5,a1
  70.         moveq    #0,d0
  71.         move.w    LIB_NEGSIZE(a5),d0
  72.         sub.w    d0,a1
  73.         add.w    LIB_POSSIZE(a5),d0
  74.         jsr    _LVOFreeMem(a6)
  75.         move.l    d2,d0
  76.         movem.l    (sp)+,d2/a5/a6
  77.         rts
  78. .still_openned
  79.         Lib    ExtFuncLib
  80.         moveq    #0,d0
  81.         rts
  82.  
  83.         ;... here your funcs ...
  84.  
  85.         Lib    END